package com.slz3.business.module.orderManagement.ordOrderLogistics.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.orderManagement.ordOrderLogistics.domain.OrdOrderLogistics;
import com.slz3.business.module.orderManagement.ordOrderLogistics.domain.OrdOrderLogisticsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class OrdOrderLogisticsTransactionalServiceImpl implements OrdOrderLogisticsTransactionalService {

    @Override
    public OrdOrderLogistics modify(OrdOrderLogistics ordOrderLogisticsNew) {
        Repositorys.ordOrderLogistics.test();
        Repositorys.ordOrderLogistics.save(OrdOrderLogisticsFactory.initBaseFields());
        System.err.println(1/0);
        ordOrderLogisticsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.ordOrderLogistics.saveAndFlush(ordOrderLogisticsNew);
    }

    @Override
    public List<OrdOrderLogistics> batchModify(List<OrdOrderLogistics> ordOrderLogisticsList) {
        return Repositorys.ordOrderLogistics.saveAll(ordOrderLogisticsList);
    }
}
